const mongoose = require('mongoose'),
    DB_URL = 'mongodb://localhost:27017/myspace';

mongoose.connect(DB_URL, { useNewUrlParser: true, useUnifiedTopology: true, useCreateIndex: true });

mongoose.connection.on('connected', function () {    
    console.log('mongodb ok');  
});    


mongoose.connection.on('error',function (err) {    
    console.log('mongodb err: ' + err);  
});    
 

mongoose.connection.on('disconnected', function () {    
    console.log('mongodb down');  
});    
